package headertea;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.util.ArrayList;
import java.util.List;

import org.hibernate.Criteria;
import org.hibernate.Session;
import org.hibernate.Transaction;
import org.hibernate.criterion.Order;
import org.hibernate.criterion.Restrictions;
import org.hibernate.query.Query;

import util.HibernateUtil;
import headertea.applyHeaderTeacher;
import entity.HeaderTeacher;

public class applyHeaderTeacherDaoImpl implements applyHeaderTeacher{
	
	//班主任申请班主任权限
	@Override
	public boolean applyHeaderTeacher(HeaderTeacher teacher) {
		Session session = null;
		Transaction tran = null;
		try {
			session = HibernateUtil.openSession();
			tran = session.beginTransaction();
			
			HeaderTeacher a=session.load(HeaderTeacher.class,1);
			teacher.setloginName("xiaohua");
			teacher.setid("554");
			teacher.setpassword("123456");
			teacher.setsex("男");
			session.update(teacher);
			tran.commit();
			return true;
		} catch (Exception e) {
			e.printStackTrace();
			tran.rollback();
			return false;
		} finally {
			if (null != session) {
				session.close();
			}
		}
	}
}